<?php
class commentAction extends security_normal {
	
	function action(){
		$miceSession = new session();
		global $conn;
		if($_POST){
			if($_POST['checkcode']<>$miceSession->get('checkcode')){
				MessageBox('验证码错误','back');
				exit;
			}

			if($_POST['name']==''){
				MessageBox('请填写姓名','back');
				exit;
			}

			if($_POST['content']==''){
				MessageBox('请填写评论内容','back');
				exit;
			}

			$form=new model_Form();
			
			if($miceSession->get('mu__userid')<1){
				$form->setUserId(0);
			}else{
				$form->setUserId($miceSession->get('mu__userid'));
			}
			$form->setName(MiceFilterHtml($_POST['name']));
			$form->setEmail(MiceFilterHtml($_POST['email']));
			$form->setTitle(MiceFilterHtml($_POST['title']));
			$form->setCreatedat(time());
			$form->setType($_POST['type']);
			$form->setParentid($_POST['parentid']);
			$form->setIp(GetRealIp());
			$form->setContent(MiceFilterQuote($_POST['content']));
			$form->setIsopen(1);
			$results=$form->doInsert();

			if($results){
				MessageBox('提示信息','back','发表评论成功');
			}else{
				MessageBox('发表评论失败','back');
			}
			exit;
		}else{
			MessageBox('请填写评论内容','back');
			exit;
		}
	}	
}
?>